<template>
  <div>
    <el-card>
		
	</el-card>
    <el-button :disabled = "clockIn" v-if="clockIns"  @click="ClockIn" >上班打卡</el-button>
    <el-button :disabled = "clockOut"  v-if="clockOuts" type="primary" @click="ClockOut">上班签退</el-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      clockIn:false,
      clockOut:false,
       clockIns:false,
      clockOuts:false,
    };
  },
  created() {clockOuts
    // this.getUserIsZiXun();
  },
  methods: {
     async ClockIn(){
       const {data:res} =await this.$http.get('api/SignIn/ClockIn')
       console.log(res)
        if (res.code !== 0) {
           this.clockIn=true
          this.clockOut=false


          this.clockIns=false
          this.clockOuts=true
					return this.$message.error(res.msg)
				}
        this.clockIn=true
         this.clockOut=false

         
            this.clockIns=false
          this.clockOuts=true
         this.$message.success(res.msg)
    },
    async ClockOut(){
       const {data:res} =await this.$http.get('api/SignIn/ClockOut')
       console.log(res)
        if (res.code !== 0) {
           this.clockIn=true
          this.clockOut=true
					return this.$message.error(res.msg)
				}
        this.clockIn=true
         this.clockOut=true
         this.$message.success(res.msg)
    },
     async getUserIsZiXun(){
       const {data:res} =await this.$http.get('api/SignIn/GetUserIsZiXun')
       console.log(res)
      if (res.code != 0) {
         this.clockIn=true
        this.clockOut=true
					return this.$message.error(res.msg)
			}
        this.clockIn=false
        this.clockOut=true
        this.clockIns=true
         this.$message.success(res.msg)
    }
  },
  mounted: function () {
    this.getUserIsZiXun();
  },
  computed: function () {},
};
</script>

<style>
</style>
